<?php

if (session_id() == '')
    session_start();
$session = session_id();
$time = time();
$ip=ip2long($_SERVER['REMOTE_ADDR']);
$date=date('dmY');
$prev_date=date('dmY',  strtotime('-1 day'));
$data['categories'] = $this->category_model->getAllCategories();
$data['accessory_categories'] = $this->category_model->getAllAccessoryCategories();
$data['slides'] = $this->slide_model->getAllSlides();

$c = $this->category_model->getAllAccessoryCategories();
$arr = array();
foreach ($c as $row):
    $a = $this->accessory_model->getAccessoryByCategory($row->category_id);
    array_push($arr, $a);
endforeach;
$data['arr_accessory_right'] = $arr;

$data['online'] = $this->counter_model->getOnlines($session, $time);
$data['total_counter']=$this->counter_model->getAllCounter();
$data['today_counter']=$this->counter_model->getCounter($ip,$date);
$data['yesterday_counter']=$this->counter_model->getCounter($ip,$prev_date);

$this->counter_model->addCounter($ip,$date);

?>
